import component from "../../../../common/component";
import {Button ,Tag} from "antd";
import EditAndDelBtn from "@/components/EditAndDelBtn"
import EditModal from "./edit";
class topic extends component {
         //右上角 新建设备类型与删除选中 按钮
        getButtonRow(): null {
            return <>
                <Button className={'button-delete button-default'} onClick={this.handleAdd} type="primary" >
                        新增课题信息
                </Button>
            </>;
        }
        //主体部分页眉
        getColumns(): null {
            return [
                {
                    title: '课题研究层次',
                    dataIndex: 'type',
                    key: 'type',
                    width: 150,
                },
                {
                    title: '名称',
                    dataIndex: 'name',
                    key: 'name',
                    width: 300,          
                    
                },
                {
                    title: '负责人',
                    dataIndex: 'creator',
                    key: 'creator',
                    width: 100,
                   
                },
                {
                    title: '时间',
                    dataIndex: 'stime',
                    key: 'stime',
                    width: 100,
                },
                {
                    title: '状态',
                    dataIndex: 'state',
                    key: 'state',
                    width: 100,
                    render (state) { 
                        let config = {                      
                            '在研': <Tag color="success">在研</Tag>,
                            '结题': <Tag color='default'>结题</Tag>,
                        }
                        return config[state];
                    }
                },
                {
                    title: '操作',
                    dataIndex: 'operation',
                    fixed: 'right',
                    width: 100,
                    render: (_, record) => {
                        return <EditAndDelBtn record={record} edit={this.edit} del={this.delete}/>
                    },
                }
            ];
        }
    
    
        getEditModal(): null {
            return <EditModal {...this.state.editParam} cancelModal={this.cancelModal} reload={this.reload}
                              baseUir={this.state.baseUri}/>
        }
    }

export default topic;